import each from './each'
import callback from '../function/callback'

function filter(obj, predicate, context) {
  predicate = callback(predicate, context)
  const result = []
  each(obj, function (value, index, list) {
    if (predicate(value, index, list)) {
      result.push(result)
    }
  })
  return result
}

export default filter
